// components/fastNavigation/fastNavigation.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    animationData: {},
    showNavigationMask: false, //是否展示底部蒙层
  },

  /**
   * 组件的方法列表
   */
  methods: {
    showMenu: function() {
      //创建动画
      var animation = wx.createAnimation({
        duration: 500,
        timingFunction: "ease",
        delay: 0,
        transformOrigin: "50% 50%",
      });
      //第一步先将动画放在要出现之前的位置
      animation.translateX(-200).step();
      this.setData({
        animationData: animation.export(),
        showNavigationMask: true,
      })
      // setTimeout(() => {
      //   animation.translateX(0).step();
      //   this.setData({
      //     animationData: animation.export(),
      //   })
      // }, 100)
    },
    hideMeun: function() {
      //创建动画
      var animation = wx.createAnimation({
        duration: 500,
        timingFunction: "ease",
        delay: 0,
        transformOrigin: "50% 50%",
      });
      animation.translateX(0).step();
      this.setData({
        animationData: animation.export(),
      })
      setTimeout(()=>{
        this.setData({
          showNavigationMask: false,
        })
      },500)

    },
    //跳转到某个页面
    naviToPage:function(e){
      console.log(e);
      let pageName = e.currentTarget.dataset.page;
      wx.switchTab({
        url: '/pages/' + pageName + '/' + pageName,
        success: function(res) {},
        fail: function(res) {},
        complete: function(res) {},
      })

    }
  }
})